package com.lsf.studentmanagerup.servlet.classbean;

import com.lsf.studentmanagerup.service.ClassBeanService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author 李树飞
 */
@WebServlet(name = "RemoveClassBeanServlet", urlPatterns = "/removeClassBean")
public class RemoveClassBeanServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");

        String id = request.getParameter("id");

        ClassBeanService classBeanService = new ClassBeanService();
        classBeanService.removeClassBeanService(id);

        response.sendRedirect("getClassBean");
    }

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request,response);
    }
}
